home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / GMS / GMSDev / Source / Asm / Objects / ScreenObjectList.s < prev    next >
Encoding:
Text File  |  1998-04-18  |  4.5 KB  |  169 lines

  1. ;-------T-------T------------------------T---------------------------------;
  2. ;This demo will open a screen, based on the parameters in an external object
  3. ;file.  This allows a VERY high level of external editing that will alter
  4. ;how this program behaves, without having to reassemble it.
  5. ;
  6. ;This feature is highly important as it allows up to 100% configurability of
  7. ;your game, which previously has only been available to applications using
  8. ;libraries such as MUI.  However, it is even more powerful than this as
  9. ;graphic artists could not only create new datasets for your game, but also
  10. ;alter the dimensions, colours, resolution, attributes (and more) of your
  11. ;Bobs and Screens.  Support for code segments is also available, so
  12. ;external functions could be altered and improved by programmers.  This will
  13. ;ensure that your game has a long lasting future as it keeps up with current
  14. ;technology and additions to GMS.
  15. ;
  16. ;I hope you make the most of external objects, its worth it!
  17.  
  18.     INCDIR    "GMSDev:Includes/"
  19.     INCLUDE    "dpkernel/dpkernel.i"
  20.     INCLUDE    "files/objects.i"
  21.     INCLUDE    "modules/objects.i"
  22.  
  23.     SECTION    "Demo",CODE
  24.  
  25. ;===========================================================================;
  26. ;                             INITIALISE DEMO
  27. ;===========================================================================;
  28.  
  29.     STARTDPK
  30.  
  31. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  32.     move.l    DPKBase(pc),a6
  33.     lea    OBJFileName(pc),a0    ;a0 = Name of the object file.
  34.     moveq    #ID_OBJECTFILE,d0    ;d0 = ID_OBJECTFILE
  35.     CALL    Load    ;>> = Go and load it.
  36.     move.l    d0,ObjectFile    ;MA = Save the base.
  37.     beq    .Exit    ;>> = Quit if error.
  38.  
  39.     ;Open the objects module.
  40.  
  41.     lea    ObjModTags(pc),a0    ;a0 = Module tags.
  42.     sub.l    a1,a1    ;a1 = No container.
  43.     CALL    Init    ;>> = Initialise Cards Interface.
  44.     tst.l    d0    ;d0 = Check for error.
  45.     beq    .Exit    ;>> = Error, exit.
  46.     move.l    d0,a0    ;a0 = Card module.
  47.     move.l    MOD_ModBase(a0),OBJBase    ;ma = Store jump table.
  48.  
  49.     move.l    OBJBase(pc),a6
  50.     move.l    ObjectFile(pc),a0    ;a0 = Object Base.
  51.     lea    Objects(pc),a1    ;a1 = A list of objects to get.
  52.     CALL    PullObjectList    ;>> = Get our objects.
  53.     tst.l    d0    ;d0 = Success?
  54.     bne.s    .Exit    ;>> = Quit if error.
  55.  
  56.     ;Initialise the screen.
  57.  
  58.     move.l    DPKBase(pc),a6
  59.     move.l    Screen(pc),a0    ;a0 = Screen tags.
  60.     sub.l    a1,a1    ;a1 = No container.
  61.     CALL    Init    ;>> = Initialise the screen.
  62.     tst.l    d0    ;MA = Save pointer to the Screen.
  63.     beq.s    .Exit    ;>> = Quit if error.
  64.  
  65.     ;Initialise the picture.
  66.  
  67.     move.l    Picture(pc),a0
  68.     move.l    Screen(pc),a1
  69.     move.l    PIC_Bitmap(a0),a2
  70.     move.l    GS_MemPtr1(a1),BMP_Data(a2)
  71.     sub.l    a1,a1
  72.     CALL    Init
  73.     tst.l    d0
  74.     beq.s    .Exit
  75.  
  76.     move.l    SCRBase(pc),a6
  77.     move.l    Screen(pc),a0
  78.     move.l    Picture(pc),a1
  79.     move.l    GS_Bitmap(a0),a2
  80.     move.l    PIC_Bitmap(a1),a1
  81.     move.l    BMP_Palette(a1),BMP_Palette(a2)
  82.     CALL    scrUpdatePalette
  83.  
  84.     move.l    DPKBase(pc),a6
  85.     moveq    #ID_JOYDATA,d0    ;Get joydata structure for reading
  86.     CALL    Get    ;port 0.
  87.     move.l    d0,JoyData
  88.     beq.s    .Exit
  89.     move.l    d0,a0    ;Initialise the joydata structure.
  90.     sub.l    a1,a1
  91.     CALL    Init
  92.     tst.l    d0
  93.     beq.s    .Exit
  94.  
  95.     move.l    Screen(pc),a0
  96.     CALL    Display
  97.  
  98.     bsr.s    Main
  99.  
  100. .Exit    move.l    DPKBase(pc),a6
  101.     move.l    JoyData(pc),a0
  102.     CALL    Free
  103.     move.l    Picture(pc),a0
  104.     CALL    Free
  105.     move.l    Screen(pc),a0
  106.     CALL    Free
  107.     move.l    ObjectFile(pc),a0
  108.     CALL    Free
  109.     move.l    ObjModule(pc),a0
  110.     CALL    Free
  111.     MOVEM.L    (SP)+,A0-A6/D1-D7
  112.     moveq    #ERR_OK,d0
  113.     rts
  114.  
  115. ;===========================================================================;
  116. ;                                MAIN LOOP
  117. ;===========================================================================;
  118.  
  119. Main:    move.l    SCRBase(pc),a6
  120.     CALL    scrWaitAVBL
  121.  
  122.     move.l    DPKBase(pc),a6
  123.     move.l    JoyData(pc),a0
  124.     CALL    Query
  125.     move.l    JoyData(pc),a0
  126.     move.l    JD_Buttons(a0),d0
  127.     btst    #JB_LMB,d0
  128.     beq.s    Main
  129.     rts
  130.  
  131. ;===========================================================================;
  132. ;                                  DATA
  133. ;===========================================================================;
  134.  
  135. JoyData:    dc.l  0
  136. ObjectFile:    dc.l  0
  137. OBJBase:    dc.l  0
  138. OBJFileName:    FILENAME "GMS:demos/data/OBJ.Screen"
  139.  
  140. Objects:    dc.l  OBJECTLIST,0
  141.         dc.l  TXT_Screen
  142. Screen:        dc.l  0
  143.         dc.l  TXT_Picture
  144. Picture:    dc.l  0
  145.         dc.l  LISTEND
  146.  
  147. TXT_Screen:    dc.b  "Screen",0
  148.         even
  149. TXT_Picture:    dc.b  "Picture",0
  150.         even
  151.  
  152. ObjModTags:    dc.l  TAGS_MODULE
  153. ObjModule:    dc.l  0
  154.         dc.l  MODA_Name,ObjName
  155.         dc.l  TAGEND
  156.  
  157. ObjName:    dc.b  "mod.objects",0
  158.         even
  159.  
  160. ;===========================================================================;
  161.  
  162. ProgName:    dc.b  "Object List Demo",0
  163. ProgAuthor:    dc.b  "Paul Manias",0
  164. ProgDate:    dc.b  "February 1998",0
  165. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  166. ProgShort:    dc.b  "Object demonstration.",0
  167.         even
  168.  
  169.